home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8404 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  846 b 

  1. Path: news.ner.bbnplanet.net!forest!ebromber
  2. From: ebromber@forest.drew.edu
  3. Newsgroups: comp.lang.c
  4. Subject: Programming Question
  5. Message-ID: <1996Mar3.164754.137341@forest>
  6. Date: 3 Mar 96 16:47:54 EST
  7. Organization: Drew University
  8.  
  9. Below is part of the code for a password program which I wrote. However, 
  10. wheneve I run the program, the "ENTER PASSWORD HERE" only appears after a 
  11. carriage return is entered. In other words, I have to type the password in 
  12. before it prints that message. If I hit return, it accepts that as the 
  13. password. I wrote this program on a pc and used a MS-DOS compiler. Does 
  14. anyone know why and how I can fix this?
  15.  
  16. Thanks in advance.
  17. ebromber@drew.edu
  18.  
  19. PARTIAL CODE
  20.     int pass[100];
  21.     int count=0;
  22.     char ch;
  23.     printf("ENTER PASSWORD HERE: ");
  24.     while (ch=getch() !='\n')
  25.     { pass[count]=ch;
  26.       putch('*');
  27.       count++;
  28.     }    
  29.